import { XiuXianCore } from './apps/xiuxian_core.js';
import { XiuXianCultivation } from './apps/xiuxian_cultivation.js';
import { XiuXianItems } from './apps/xiuxian_items.js';
import { XiuXianTasks } from './apps/xiuxian_tasks.js';
import { XiuXianSkills } from './apps/xiuxian_skills.js';
import { XiuXianSect } from './apps/xiuxian_sect.js';
import { XiuXianRanking } from './apps/xiuxian_ranking.js';
import { XiuXianAdmin } from './apps/xiuxian_admin.js';
import { XiuXianUtils } from './apps/xiuxian_utils.js';
import { XiuXianData } from './apps/xiuxian_data.js';

class XiuXianGame {
    constructor() {
        this.data = new XiuXianData();
        this.utils = new XiuXianUtils();
        this.core = new XiuXianCore();
        this.cultivation = new XiuXianCultivation();
        this.items = new XiuXianItems();
        this.tasks = new XiuXianTasks();
        this.skills = new XiuXianSkills();
        this.sect = new XiuXianSect();
        this.ranking = new XiuXianRanking();
        this.admin = new XiuXianAdmin();
    }

    async init() {
        await this.data.loadAllData();
        // 初始化其他模块
        this.core.data = this.data;
        this.core.utils = this.utils;
        this.cultivation.data = this.data;
        this.cultivation.utils = this.utils;
        this.items.data = this.data;
        this.items.utils = this.utils;
        this.tasks.data = this.data;
        this.tasks.utils = this.utils;
        this.skills.data = this.data;
        this.skills.utils = this.utils;
        this.sect.data = this.data;
        this.sect.utils = this.utils;
        this.ranking.data = this.data;
        this.ranking.utils = this.utils;
        this.admin.data = this.data;
        this.admin.utils = this.utils;

        console.log('修仙游戏初始化完成');
    }
}

const xiuxianGame = new XiuXianGame();
xiuxianGame.init().catch(console.error);

export default xiuxianGame;
